﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using hello.csharp.common.Interfaces;
using hello.csharp.common.Interfaces.Storages;
using hello.csharp.domain;
using hello.csharp.storage.Db.Mongo;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;

namespace hello.csharp.storage
{
    public class ProductStorageWrite : MongoStorageBase, IProductStorageWrite
    {
        private readonly IMongoCollection<Product> _collection;

        public ProductStorageWrite(IDbManager dbManager)
            : base(dbManager)
        {
            _collection = _Database.GetCollection<Product>(nameof(Product));
        }

        #region Implementation of IStorageWrite<in Product,in string>

        /// <summary>
        /// 当前实现面向的数据表表名
        /// </summary>
        public string TableName { get; } = $"{nameof(Product)}s";

        /// <summary>
        /// 将指定的对象插入数据库中
        /// </summary>
        /// <param name="obj">指定的对象</param>
        public Task InsertAsync(Product obj)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 更新指定的对象
        /// </summary>
        /// <param name="obj">指定的对象</param>
        public Task UpdateAsync(Product obj)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 根据记录ID，逻辑删除指定记录，即打上“已删除标记”，但并不从数据库中删除记录
        /// </summary>
        /// <param name="id">指定的记录ID</param>
        public Task LogicDeleteAsync(string id)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 根据记录ID，从数据库中移除该记录，该记录被移除后，不可恢复
        /// </summary>
        /// <param name="id">指定的记录ID</param>
        public Task RemoveAsync(string id)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
